const { mongoose } = require("./db");

const orderSchema = new mongoose.Schema({
  type: {
    type: String,
    default: "",
  }, //商品类型
  cost: {
    type: Number,
    default: "",
  }, //跑腿费用
  range: {
    type: Number,
    default: "",
  }, //跑腿距离
  fares: {
    type: Number,
    default: 0,
  }, //距离加价
  price: {
    type: Number,
    default: 0,
  }, //物品价格
  weight: {
    type: Number,
    default: "",
  }, //物品重量
  statue: {
    type: String,
    default: "",
  }, //订单状态
  pikup: {
    type: Object,
    default: "",
  }, //取件时间
  rider_pikup: {
    type: Date,
    default: "",
  }, //骑手取件时间
  place: {
    type: Date,
    default: new Date(),
  }, //下单时间
  takeTime: {
    type: Date,
    default: new Date(),
  }, //骑手接单时间
  payTime: {
    type: Date,
    default: "",
  }, //支付时间
  deliveryAddress: {
    type: Object,
    default: "",
  }, //收件地址
  pickupAddress: {
    type: Object,
    default: "",
  }, //取件地址
  pay: {
    type: String,
    default: "",
  }, //支付方式
  done: {
    type: String,
    default: "",
  }, //结算状态
  commission: {
    type: Number,
    default: "",
  }, //佣金
  desc: {
    type: String,
    default: "",
  }, //订单备注
  // image:String,//图片
  uid: {
    type: mongoose.Types.ObjectId,
    ref: "wxuser",
  },
  rid: {
    type: mongoose.Types.ObjectId,
    ref: "rideruser",
  },
  gid: {
    type: mongoose.Types.ObjectId,
    ref: "goods",
  },
  attitude: {
    type: Number,
  },
  speed: {
    type: Number,
  },
  evaluation: {
    type: String,
  },
});
const orderModel = mongoose.model("order", orderSchema);

module.exports = { orderModel };